******************************************************************
*
* NOTE: After each revision is made, the splash screen and the value
*       of KVERSION in the Global Page must be updated to reflect the
*
* Ver 1.0 - Written by J.R. Huston
*         - Updated and released by Dale M. Arends, Dec. 1983
*
* Ver 1.0.1 - by Dale M. Arends, January 1, 1984
*         1.  Bug in status call when testing write protect fixed.
*               (File: READ.WRITE)
*
* Ver 1.0.1A01 - Dale M. Arends, January 20, 1984
*         2.  Force FLUSH of after EOF cutback.
*               (File: CLOSE.EOF)
*
* Ver 1.0.2 - Dale M. Arends, February 7, 1984
*         3.  Replace LDAs with BITs in Interrupt entry area of
*             Global page so it won't destroy Accumulator.
*               (Files: GLOBALS)
*         4.  Fixed bug in Disk core routines so that motor is
*             certain to shut off after recal on an error.
*               (File: XRW1)
*
* Ver 1.0.2A01 - Dale M. Arends, February 13, 1984
*         5.  Rearranged MLI layout within Language Card.
*               (All Files Affected)
*         6.  Rearranged entry to XRW routines to make room for 
*             a CLD as first byte.  This is necessary since XRW 
*             routines are now at $D000 and the CLD flags bank as 
*             Main $D000 space.  Also added check for valid call
*             number (0-3).  (Both XRW files affected.)
*
* Ver 1.0.2A02 - Dale M. Arends, April 4, 1984
*         7.  Rewrote machine ID routine to allow for Phylums of
*             machines.    Ranges:  0n - //c
*                                   4n - ???
*               (File: PROLDR)      8n - ???
*                                   En - //e
*
*         8.  Removed support for boot in 48K machines.
*               (File: PROLDR)
*
* Ver 1.1XA01 - Dale M. Arends, May 3, 1984 
*         9.  Modified Interrupt routine to allow for new ROMs in //c
*             and //e machines.
*               (Files: PROLDR, EQUATES, GLOBALS, XDOSMLI)
*        10.  Removed check for OS version number in file OPEN routine.
*               (File: POSN.OPEN)
*        11.  Incremented KVERSION number in Global page.
*               (Files: GLOBALS)
*        12.  Modified DEVSRCH routine to correctly reflect the
*             presence of any 80-col card following established
*             signature byte protocol.
*               (File: DEVSRCH)
*
* Ver 1.1XA02 - Dale M. Arends, May 11, 1984
*        13.  Added routine to allow for firmware in slot 3 to be
*             enabled. In //e, internal $C300 firmware is enabled
*             if no ROM in slot 3.  This is necessary for interrupts
*             and BRKs to work.  NOTE: any ROMs in slot 3 MUST support
*             the 80-column interrupt and BRK entry points or an
*             interupt or BRK will cause a system hang.
*               (File: PROLDR)
*        14.  Added routine to turn off all disk motor phases prior
*             to SEEKing a track on a Disk II call.
*               (File: XRW2)
*
* Ver 1.1XA02 renamed Ver 1.1 - Dale M. Arends, June 14, 1984
*
* Ver 1.1 - by Dale M. Arends (New date in splash screen 7-19-84)
*        15.  Added routine for accessing user installed drivers
*             located in AUX Language Card.
*               (Files: PROLDR, MEMMGR)
* Ver 1.1 - by Dale M. Arends (New date in splash screen 08-17-84)
*        16.  Added work-around for bug when accessing /RAM after it
*             has been removed from DEVLST.
*               (File: NEWFNDVOL)
*        17.  Reduced the RAM DISK by 1 block to protect the interrupt
*             vector area of the Aux Language Card.  Interrupt vectors
*             installed in the Aux Language Card at boot time.
*               (File: RAM, PROLDR)
*
* Ver 1.1.1 - by Dale M. Arends (New date in splash screen 9-18-84)
*        18.  Fixed routine in RSETPHSE to map into Drive 1.
*               (File: XRW2)
*        19.  Rewrote Machine ID routine to give I/O precedence to
*             an identifiable 80-column card in Slot 3.
*               (File: PROLDR)  (See #12 above.)
*
* Ver 1.2XA01 - by Dale M. Arends - 10/3/84
*        20.  Added MLI Call for AppleBus and driver calling code.
*              (Files: EQUATES, PROLDR, XDOSMLI, MEMMGR, DATATBLS)
*        21.  Fixed bug in error return of Ram Disk Driver.
*              (File: RAM)
*        22.  Assigned a SYSTEM ERROR when error occurs in deallocating
*             blocks from a TREE file.
*              (File: DETREE)
*        23.  Fixed bug in zeroing of a VCB when trying reallocating
*             a previously used VCB.
*              (File: NEWFNDVOL)
*        24.  Modified Loader to automatically install up to 4 drives if
*             the Smart Driver follows the defined $CnFE bit protocol.
*              (File: DEVSRCH)
*        25.  Modified MLI entry routines to disable interrupts until
*             after MLIACTV flag is set and CMDADR is set up.
*             (Note: change is not noted in source code.)
*              (Files: GLOBALS, XDOSMLI)
*
* Ver 1.2XA02 - Lost in the Wilds of the San Jose Triangle.
*        (Go to the Bermuda Triangle and turn left.)
*
* Ver 1.2XA03 - by Dale M. Arends - 1/24/85
*        26.  Modified Dispatcher to treat the DELETE key as a
*              Back Space (Left Arrow).
*              (File: SEL)
*
* Ver 1.2XA04 - by Dale M. Arends - 1/28/85
*        27.  Modified splash screen to reflect version control loss.
*              (File: DEVSRCH)
*
* Ver 1.2XA05 - by Kerry Laidlaw - 2/11/85
*        28.  Modified the ONLINE call to zero out a VCB corresponding
*             to a disconnected device.  Previously if a user followed
*             our method on disconnecting a device by removing the
*             volume's device number in the device list, and removing
*             the device handler's address from the device vector table,
*             ProDOS never removed the corresponding VCB entry.  Now
*             in addition to the above, the user can then issue a 
*             specific ONLINE call to the user disconnected device.  A 
*             no device connected error ($28) will be returned in the 
*             accumulator, but the VCB will be taken off line.
*              (File: BFMGR)
*
* Ver 1.2XA06 - by Kerry Laidlaw - 3/20/85
*        29.  Fixed bug in PROLDR file that did not swap back correct 
*             bank.
*              (File:PROLDR)
*        30.  Added the "real" AppleTalk drivers that will reside in  
*             bank 2, $D400-$DFFF, in the Main Language Card.
*              (File:BUS)
*
* Ver 1.2xa08 - by Kerry Laidlaw - 5/15/85
*        31.  Updated Copyright Notices in source & in splash screen.
*              (Files:MLI,GLOBALS)
*        32.  Set KVERSION byte in global page to $82.  This version
*             ID byte is interpreted as follows:
*                The low 7 bits contain the ProDOS version number.
*                The high bit is set if this version of ProDOS 
*                supports AppleTalk.
*              (Files:GLOBALS)
*        33.  Removed 4 drive install code (see #24 above) to prevent
*             problems with applications.  Some applications would 
*             interpret unit numbers as mapping to physical slots.  Thus
*             even though unit numbers may only have a logical mapping,
*             these applications would assume a disk card is in the 
*             physical slot.  Therefore if an I/O card is in that slot,
*             the application wouldn't look for it.
*              (File:DEVSRCH)
*
*        34.  Commented out one to [sic] many pla's from the dispatcher
*             calling routine.
*              (File:MEMMGR)
*
*        35.  Added an unclaimed (spurious) interrupt handler. It allows
*             255 unclaimed interrupts before going to system death.
*              (File:XDOSMLI)
*
*        36.  Removed low res mode evocation when displaying system
*             death messages.  (It was buggy to begin with and it saves
*             me 6 bytes:lda c083,lda c086).
*             Also removed ability to display system death message 
*             without '-ERR xx' as part of the message.  This was done
*             to save space.  The system itself never used this ability
*             and hopefully no one else did either....
*              (Files:XDOSMLI,DATATBLS)
*
*        37.  Since the JSPARE vector in the global page was the only 
*             vector to the SYS.RTS routine which will halt the system
*             with an 'INSERT SYSTEM DISK AND RESTART' message), and 
*             JSPARE is overwritten by the loader with the dispatcher
*             calling vector, the 6 bytes starting at the SYS.RTS label
*             are now considered free space.
*              (File:GLOBALS)
*
*        38.  Deleted needless code that relocated Atalk drivers twice.
*             Also modified parameters that relocate interrupt file
*             MLI.3.
*              (File:PROLDR)
*
* Ver 1.2xa09 - by Kerry Laidlaw - 5/30/85
*        39.  Fixed bug in dispatcher that would trash screen holes
*             when code is called while in 80 column mode.  (Previously
*             HOME was called without the window size being updated to
*             a 40 column size.  Therefore the wrong BASCALC's were
*             done and zap!).  Now, I call SETTXT before calling home
*             which will set text mode and a 40 column window. 
*             I also commented out a lda #0 to reclaim needed space.
*              (File:SEL)
*
*        40.  Made code that zeroed user's index block in his I/O
*             buffer into a subroutine.  Saved 8 bytes.
*              (Files:READ.WRITE,POSN.OPEN)
*
*        41.  Set a flag in the DELETE code to signal the DETREE routine
*             NOT to zero index blocks upon deallocation.  This was done
*             so developers could write file recovery routines.
*              (Files:DESTROY,DETREE,WRKSPACE)
*
* Ver 1.2xa10 - by Kerry Laidlaw - 6/4/85
*        42.  Replaced two lda's and bit's with one sta to hit the bank
*             switches (c083,c08b).  Note: I am counting on the fact
*             that once into ProDOS, the LC is already in a r/w state.
*             Thereafter, you only have to hit the bank switch once to
*             switch banks and maintain a r/w state in the new bank.
*             Also note that this was done to preserve zero flag status
*             upon return from the network drivers.  The previous BIT's
*             would destroy that status.
*              (File:MEMMGR)
*
*        43.  Forced the /RAM driver to return zeros on block read 
*             requests to block 7, and do nothing on block writes to
*             block 7.  Previously, a block write to block 7 (an 
*             operation that is invalid anyway), would bomb out into
*             the monitor.  Read and writes to blocks 0,1,4,5,6, and
*             now 7 are all treated in this manner.
*              (File:RAM)
*
* Version 1.2xa11 - by Kerry Laidlaw 6/12/85
*        44.  Removed disabling of interrupts from loader.  Therefore 
*             the whether the processor allows interrupts or not is 
*             left up to the monitor.
*              (File:DEVSRCH)
*
* Version 1.2xa12 - by Kerry Laidlaw 6/21/85
*        45.  Initialized main stack to $ff and set up $101 in Aux
*             memory (if it is there) to $ff so programs using the
*             aux stack will be started off correctly.
*              (File:PROLDR)
*
*        46.  Fixed 2 bugs in XDOSMLI file: 
*             1) After processor is pulled to re-enable interrupts,
*                a CLD is now done to keep out of decimal mode.
*             2) Turning "off" MLIACTIVE flag is now done correctly
*                with an ASL after and initial ROR instead of the 
*                original LSR.
*
* New version id for fear of version confusion 12/13/85...
* Version 1.2 exp 01 - by Kerry Laidlaw 12/13/85
*        47.  The OPEN call will now return error $4B (unsupported or
*             incorrect storage type) instead of $4A (incompatible file
*             format for this version) when determining if it is legal
*             to open a file of a particular storage type.
*               (File: POSN.OPEN)
*
* Version 1.2 exp 02 - by Kerry Laidlaw 2/3/86
*        48.  Splash screen now shows "PRODOS 8" instead of "PRODOS".
*             Fixed a bug in the read call that would return the
*             incorrect number of bytes transferred when newline was
*             enabled.  If the requested number of bytes was greater
*             than $00FF, AND the number of bytes in the file AFTER the
*             newline character was READ was a multiple of $100, then
*             the number of bytes reported transferred by ProDOS was
*             equal to the correct number of transferred bytes + $100.
*               (Files: DEVSRCH, READ.WRITE)
*
*        49.  Removed fix from rev #41 that prevented index blocks 
*             from being zeroed after files were deleted.
*              (Files: DESTROY, DETREE, WRKSPACE)
*
*        50.  Added new clock driver to read the Cortland builtin clock.
*             The loader will now check for a Cortland to decide which
*             clock driver (slot or built-in) to install.
*             Stopped messing with slot 3 rom space if running on a 
*             Cortland.  The Control Program lets the user determine
*             internal vs. external slot space.
*             Also commented out bus references in equates file, since
*             it has now been decided that there be no Appletalk drivers
*             in this version of ProDOS8.
*              (Files: EQUATES, PROLDR, CCLOCK)
*
* Version 1.2 exp 03 - by Kerry Laidlaw 2/20/86
*        51.  Updated slot clock driver's year lookup table.
*             The year can now be calculated thru 1991.
*              (File: TCLOCK)
*
* Version 1.2 exp 04 - by Kerry Laidlaw 3/07/86
*        52.  Updated Cortland clock driver to adjust to new 
*             miscellaneous toolset call number.
*
* Version 1.2 exp 05 - by Kerry Laidlaw 3/13/86
*        53.  Updated DEVSRCH to special case a Smartport card
*             in slot 5 to allow 4 Smartport units. Driver entry 
*             addresses for these Smartport units would be placed in
*             the ProDOS global page's slot 5 and slot 2 driver vectors.
*             ProDOS unit numbers $50 & $D0 (slot 5, drives 1 and 2)
*             will correspond to Smartport units 1 and 2.  ProDOS unit
*             numbers $20 and $A0 (Slot 2 drives 1 and 2), will
*             correspond to Smartport units 3 and 4.
*              (File: DEVSRCH) 
*
* Version 1.2 exp 06 - by Kerry Laidlaw 04/03/86
*        54.  Updated Smartport unit special casing (see rev note #53)
*             to ensure the extra two unit numbers to have a $B in
*             the low nibble so the FILER won't have any problems
*             with formatting.  Also set version id byte (KVERSION) in
*             global page to $02 representing version 1.2.
*              (Files: DEVSRCH, GLOBALS)
*
* Version 1.2 D1 - by Kerry Laidlaw 06/22/86
*        55.  Crunched the dispatcher code to make room so the correct
*             soft switches and monitor routines could be called to
*             go to 40 columns and display text.
*              (File: SEL)
*
*        56.  Added feature to loader that will load and JSR to the
*             file "ATINIT" in the booting volume's root directory.
*             If the file is not found, no error is reported, and
*             the ".SYSTEM" file is executed as normal.  But if an
*             I/O error other than file not found is encountered 
*             or if the file type is not the ATINIT type of $f8
*             while loading "ATINIT", a fatal error is displayed.
*              (File: PROLDR)
*
*        57.  Added an alternate loader entry point.
*             The new entry is at $2003 and is intended to be called
*             be called only by the network boot code when booting
*             over the net, and by ProDOS 16 v1.0 on the Apple //-16.
*             The loader through this entry point will
*             NOT load the ATINIT file and will NOT load the 
*             .SYSTEM file.  It will set up ProDOS and RTS back 
*             to the caller to this entry point.
*             Because of this feature, the initialization of the
*             stack done in rev Note #45, was taken out....
*              (File: PROLDR)
*
*        58.  Added code to set MACHID byte to indicate a clock 
*             was present when ProDOS is run on an Apple //-16.
*              (File: PROLDR)
*
* Version 1.2A1 - by Kerry Laidlaw 06/30/86
*        59.  ATINIT file official file type now checked for is 
*             $E2.
*              (File: PROLDR)
*
* Version 1.2A2 - by Mike Askins   08/25/86
*        60.  The device searching process has changed.  SmartPort
*             devices are only installed if they exist and Disk //s
*             are placed in the device list so that they have the
*             lowest priority in device scans.  This should regularize
*             device numbering and naming in ProDOS/16.  Note that this
*             change caused the loader to grow by 256 bytes, and
*             everything beyond devsrch is moved by one page.
*              (File: DEVSRCH)
*
* Version 1.2B1 - by Mike Askins   08/25/86 
*        61.  The loader now passes a flag to Cortland at $FEFF to
*             indicate that we're running on a Cortland.  At system
*             death, if we're on a Cortland, a zero is stuffed into
*             $C029 disabling super hires so that the user can see the
*             system death message.
*              (Files: PROLDR, XDOSMLI, WRKSPACE)
*
*        62.  A parameter os.boot is now passed to Cortland AppleTalk.
*             If it is a stand alone ProDOS/8 (not P8/16 config) a
*             zero is stored in $E100BD.  Two branches had to be
*             extended to accomodate the code which does this (these
*             are marked).
*              (File: PROLDR)
*
*        63.  Two DS directives were altered (" ,0 " added) so that
*             they generated bytes with a fixed value.  Successive
*             builds should now compare byte for byte EXCEPT for the
*             date string (around 1550 decimal into PRODOS file).
*              (File: SEL)
*
*        64.  The logic of the newly added SmartPort handler in the
*             loader has been changed to fix a bug in V1.2A2 which
*             prevents installation of SmartPort devices in any slot
*             OTHER than 5.  The check for slot five was moved down
*             past the installation of drives 1 and/or 2.
*              (File: DEVSRCH)
*
* Version 1.2B2 - by Mike Askins   09/06/86 
*        65.  A bug is fixed in the loader which caused disk devices
*            in slot 2 to conflict ungracefully with more than two  
*            devices in slot 5.  Now, if any disk device is detected
*            in slot 2, NO MORE THAN 2 units are installed in slot 5.
*             (File: DEVSRCH)
*
*        66.  The Cortland Clock Driver now sets main memory before
*            doing the call to the miscellaneous tools to read the
*            clock hardware.  The main/aux state is then restored.
*
* Version 1.2B3 - by Kerry Laidlaw 09/07/86 
*        67. Updated cclock routine to correct the anding of the
*            state register.
*             (File:CCLOCK)
*
* Version 1.2   - by Mike Askins   09/08/86 
*        No changes
*
* Version 1.2   - by Mike Askins   09/23/86
*        68. Inserted a patch into RELOC to fix a bug in the 1.0 GS
*            ROM which caused the internal CX ROM space to be left
*            mapped in after a boot failure on SmartPort.  See the
*            documentation in RELOC to find out why the patch was
*            placed here (it has nothing to do with the RELOCation
*            process!).
*
* Version 1.2   - by Kerry Laidlaw 09/23/86
*        69. Fixed a bug in the dispatcher that trashes screen when
*            executed with the prefix set to nil.
*            Previously when an error occured when the pathname
*            was checked, the message at the top of the screen
*            was redisplayed. Now we are jumping so the message
*            is not redisplayed.  It saves us 2 bytes....
*             (File:SEL)
*
* Version 1.3   - by Mike Askins, Fern Bachman - 10/17/86
*        70. The code that resets the phase lines for Disk //s has been
*            changed so that the phase clearing is done with a load, not
*            a store.  Stores to even numbered locations on the disk
*            hardware cause data bus contention which is just not cool.
*            The routine has been changed to access all 8 even locations
*            which not only clears the phases but forces read mode (as
*            well as 1st drive and motor off) on entry to the disk code.
*            DOS used to do this and ProDOS did not.  If for some reason
*            (copy protection, runaway programs) l7 was left high on
*            entry to the disk routines, and the disk routines checked
*            write protect with l6 high:  BINGO -- we're in write mode.
*            Forcing read mode initially leaves less to chance.
*            to assemble ProDOS8 with cross reference tables.
*        71. The file MLI was changed to allow ASM816 version 1.4.2 to
*            allow for cross reference listings to be generated.
*            Assembling the file MLI generates ProDOS8 without listings.
*            Assembling the file L.MLI generates PorDOS8 with a listing.
*            NOTE: A blank RAM disk card called /RAM1 must be installed
*                  in the system to cross references to be generated.
*        72. The 'date' directive was removed in the file DEVSRCH
*            and an ASC 'xx-xxx-xx' directive replaced it.
*
* Version 1.3   - by Ray Chiang   11/07/86
*        73. In reference to rev notes 41 and 49, index blocks now
*            have their contents flipped when the file is deleted
*            and their contents are fully zeroed when EOF cutback
*            occurs.  This technique allows scavenging programs to
*            possibly recover files that were accidently deleted.
*            Also the possibility of unclaimed blocks 'looking'
*            like valid index blocks is reduced.  Previous to this
*            revision, whole index blocks from tree files were
*            being released back into the disk.
*            (files: DESTROY,DETREE,WRKSPACE)
*
* Version 1.3   - by Fern Bachman 11/17/86
*        74. The SmartPort interface card (our Liron interface card)
*            does not set up its device chain unless a ProDOS call
*            is made to it.  Therefore in DEVSRCH where Mike makes
*            SmartPort calls the card is not setup yet so it returns
*            00 devices in its chain.  This results in the card/drives
*            never being seen by ProDOS.  To fix that we will now make
*            a ProDOS status call before SmartPort status calls.  This
*            should guarantee valid device counts.
*            (file: DEVSRCH)
*
* Version 1.4   - by Ray Chiang/Fern Bachman 02/03/87
*        75. Fix illegal 65C02 instruction in 6502 code.  ie change
*            the BRA to a BEQ instruction.
*
* Version 1.4   - by Mike Askins/Fern Bachman 02/12/87
*        76. Changed RSETPHSE routine to only clear the phase lines.
*            And we clear Q7 so no writes can accidently occur.
*
* Version 1.4  - by Ray Chiang/Mike Askins 03/23/87
*        77. Simple programming error in fix 76 .
*
* Version 1.4 - Ray Chiang 04/17/87
*        78. No changes, released to SCM
*
* Version 1.5d1 - Grady Ward 2 Sep 87
*        79.  Fixed overrun problem in READ.WRITE 
*              Also, changed p16 patch addresses
*
*        80.  Made call to DEVMGR surrounded by NOP's so that
*              it can be patched by p16 and pquit more easily
*              (for both cache and AppleTalk booting)
*

* Version 1.5d7 - Grady Ward 20 Nov 87 Summary of Changes
*        81.  Change to READ.WRITE in tstwprot to disable interrupts
*              if going to use DMGR (Caching)
*
*        82.  P8 code has been extensively moved about to make room
*              for patches to DMGR dispatch (approximately 14 bytes 
*              were needed for AppleTalk booting patches caching patches)
*
* Version 1.5d8 4-Dec-87	Grady Ward
*
*        83.  Change some asc strings, like "system" uppercase.
*
* Version 1.5d11 20-Jan-88	Grady Ward
*
*        84.  Took out $42 generic AppleTalk Call
*
* Version 1.5b2 16-Feb-88	Grady Ward
*
*        85.  Restored asl mliactv to lsr in "exitmli"
*
*  NOTE:	Investigation of this change by Tim Harrington and myself
*	leads us to believe that the rationale for performing an
*	lsr on the "mliactiv" byte is to force the high bit to zero
*	unconditionally (note that the code is implemented so that
*	only the HIGH BIT of that byte serves as the flag to
*	indicate that an mli call is in progress when it is high,
*	and any documentation which states that the zero-value of
*	the entire byte serves as the busy flag is incorrect at
*	this time).  The reason for always forcing the busy flag
*	off, rather than restoring a previous value by use of an
*	asl instruction, is that the quit code never clears the
*	busy flag explicitly, and if control is passed to another
*	application by means of a quit call, that application will
*	inherit an environment in which the busy flag in set when
*	it should be clear; the quit call itself makes mli calls
*	(with the busy flag high--this is possible because the mli
*	never in fact checks the state of the busy flag at any time)
*	and as a side effect, the busy flag gets cleared when those
*	calls are completed because an lsr instruction forces the
*	high bit low.
*
*	This situation was a point of concern at this time because
*	the worstation software, PFI, vectors itself in as a shell
*	around P8, and is itself non-re-entrant.  The hope was that
*	the lsr could be changed back, again, to an asl in order to
*	allow "nested" busy conditions and assure that interrupt
*	routines would never re-enter PFI even if they were to gain
*	control during the time window between the completion of an
*	mli call and the completion of the PFI call which was "parent"
*	to that mli call.
*
*	The actual solution that was implemented is described in
*	revision note #100.
*	(Monte Benaresh -- April 1989)
*
* Version 1.5b3 1-Mar-88	Grady Ward
*
*        86. Clear ESC in keyboard if booting on Apple //c
*                ("slow" down for Zip Chip)
*
* Version 1.6 14-Jun-88		Grady Ward
*
*        87. Set up parallel pfixptr to fix
*                AppleTalk PFI misinterpretation
*                of two's comp prefix pointer
*
* Version 1.7 22-July-88	Grady Ward
*
*        88.  When setting eof backwards, make sure
*                 volumes bitmaps are counted before inc
*                 free blocks
*
*        89.  When installing ramdisk, make sure slot3rom
*                 is preserved rather than overwritten
*
*        90.  In system death, check "cortflag" rather than
*                 "cortland" to ascertain what system we're on
*
*        91.  Waited to restore slot3 firmware until just before
*                  gquit is called at jspare
*
*        92.  Now permit invisible bit to be set with set file info
*                  (bit 2 of d.attr byte)
*
* Version 1.8d1 01-Jan-89	Grady Ward
*
*        93.	Converted to MPW MAX assembler syntax
*
*        94.	Reworked conversion to preserve arrangement of code
*	as in v1.7.  Added vector to calldisp so that GQuit
*	can find it without having to hard-code that address.
*	This vector appears as a dc.w near the end of PROCTHREE.
*	(Grady Ward / Monte Benaresh -- December 1988)
*
*        95.	Fixed a problem where the sequence which destroys a file
*	aborts immediately without releasing the file's directory
*	entry if an I/O error occurs during deallocation of
*	blocks.  This situation leaves a directory entry for a
*	file which may be "partially deleted," i.e., some of the
*	entries in the file's index blocks may have been flipped.
*	If a user tries to delete the file again (after receiving
*	the I/O error) then the destroy code reads the partially
*	flipped index blocks and starts deallocating the wrong
*	blocks from the bitmap.  Obviously, this process can
*	ruin the integrity of the disk.
*
*	The fix causes the destroy sequence to mark the file's
*	entry as deleted even if an error occurs at any time
*	after the index blocks have been touched.  This remedy
*	was chosen given the restriction that almost no
*	bytes were available for expansion of the code.  With
*	the fix in place, the set of circumstances which
*	invoke the problem will at worst leave the disk with
*	blocks marked in the bitmap as used which belong to
*	no existing file, and stray index blocks which may
*	be partially flipped.  The user will still receive an
*	I/O error, but the file will then be absent from the
*	directory, and a subsequent attempt to delete the same
*	file will produce a "file not found" error (as would
*	normally be expected).
*
*	The implementation presumes a "critical point" in the
*	code sequence after which the file's directory entry
*	must be marked as deleted even if any operations
*	fail after that point (this point is marked in the
*	listing).  Since the code was designed to branch
*	whenever an error occurs, it was possible to change all
*	such branches (BCS) to point to the code which marks the
*	file as deleted in the directory.  This code is at the
*	label "zap_entry" and saves the accumulator (which
*	contains an error code or 0 if no error) onto the stack.
*	It then marks the memory image of the directory entry
*	as deleted and does a JSR to the routine which writes
*	the memory image out to the disk.  The code used to
*	simply jump to that routine because it was the last
*	task in the sequence, but the JSR is now necessary so
*	that the code which was pushed onto the stack can
*	be restored before returning to the user.  The ensuing
*	operation ensure that if either an error code was pushed
*	onto the stack or an error just occured when updating
*	the directory, some error will be returned (the more
*	recent code if both conditions are true).
*
*	Note that a "jsr upbmap" instruction was moved from after
*	the label "dst1" to its present position because no call
*	to a routine which might fail can occur after the "zap_entry"
*	label.  This move should be of no consequence.
*
*	The addition of the fix widened a branch that appears before
*	the label "dsdir3."  This motivated the inclusion of an
*	additional "relay" branch at "go_dstlast."
*
*	In order to accomodate the fix (and the extra branch)
*	several places in the code were "crunched" (in fact, the
*	branch mentioned above happens to appear in such a section).
*	A couple of CLC's before RTS's were commented out after
*	this engineer determined that they were redundant.  These
*	are at the labels "dsapdone" and "dseedone."
*	(Monte Benaresh -- January 1989)
*
*        96.	Fixed a bug where the ONLINE call didn't ignore the unused
*	low nybble of the unit_num parameter when deciding how
*	many bytes to zero out in the user buffer before filling it
*	in with the requested data.  Thus, if the user passed a
*	unit_num of, say, $01, P8 would zero out only the first 16
*	bytes of the user buffer, and then fill the buffer with up
*	to 256 bytes of data.  This is a problem because the user
*	was now left without the 2 null bytes which indicate the
*	end of the list when the list does not completely fill the
*	buffer.
*
*	The fix performs the mask and stores the result in "devnum"
*	for later reference and for the online1 subroutine in case
*	the unit_num is non-zero.  The online1 subroutine no longer
*	begins with "sta devnum."  For this reason, the "jsr
*	online1" just before the label "olin4" is now preceded by
*	"lda devnum."
*
*	The instructions at "olin1" used to be:
*
*		lda #1
*		sta cbytes+1
*
*	but have been replaced with simply "inc cbytes+1" since
*	"cbytes+1" was initialized to zero at the start of the
*	"online" sequence.  This was done to make room for the fix.
*	(Monte Benaresh -- January 1989)
*
*        97.	P8 now sets the video firmware "mode" byte ($4FB) to 0
*	and calls SETVID $FE93 again if running on a GS (Cortland).
*	This guarantees that the blinking "checkerboard" cursor
*	will be set up correctly when BASIC (or any other SYSTEM
*	program) gets control.  Before this change, the steady
*	solid block was appearing as the cursor if BASIC.SYSTEM
*	was launched from the finder under System Disk 4.1d10.
*	The fix appears between "savemach" and "itsp8" in
*	a section that only gets executed on a Cortland.
*	(Monte Benaresh -- February 1989)
*
*        98.	Added the "GS/OS compatibility" byte at $BFFA.
*	This byte appears at $50FA when P8 is loaded at $2000
*	(the usual load address).  GQuit now checks the value of
*	this byte after loading P8 to assure functional
*	compatibility.  The present value there is $01, and in
*	recent versions of P8 it has been $00.  For early versions,
*	there is code (which is to be relocated during P8's
*	startup sequence) at $50FA, but the actual values will not
*	interfere with this scheme until future compatibility
*	values climb very high ($2B).
*
*	Previously, GQuit checked the ASCII values of the
*	characters in the splash screen message, which required
*	GQuit to know their location.  The new scheme allows the
*	splash screen message to move (as it did for rev #97) and
*	also allows a compatible release of P8 to work with GQuit
*	even if P8's version number changes.
*	(Monte Benaresh -- February/March 1989)
*
*       98a.	Since some applications depend on the value of the
*	"kbakver" byte at $BFFE, which was the original choice
*	for the location of the "GS/OS compatibility" byte, its
*	value must be preserved as $00.  It is for this reason
*	that the GS/OS compatibility byte was moved to $BFFA.
*
*        99.	Removed the backward compatibility check that was being
*	performed when the user specified a path containing a
*	subdirectory.  The version and min_version fields are now
*	used by the GS/OS ProDOS File System Translator to store
*	upper/lower case patterns for names, so this test now
*	fails if performed on a subdirectory whose name includes
*	lower case characters as supported by the ProDOS FST.
*	Since the min_version field was never used in a meaningful
*	way, the BNE instruction in the test (before the label
*	tstpas0 in PROCTHREE) has been replaced by
*	two NOP's, so the test can never fail.
*
*	This code should actually be removed, as should all of
*	the code which supports password protection, which was
*	never functionally implemented.  Byte positions have been
*	preserved by the use of NOP's because this change comes
*	moments before the Beta release of System Disk 5.0, and
*	the incompatibility risks associated with shuffling code
*	(and recovering the space used by the bogus code) are
*	being deferred until the next release.
*	(Monte Benaresh -- March 1989)
*
*       100.	No code change.  A restriction has been imposed which
*	requires the entry point at the label "exit" on the global
*	page to remain at $BFA0, and for the state of the stack on
*	entry to that code to never change.  These restrictions are
*	added to support PFI, the workstation software, which
*	installs itself as a shell around P8.  PFI patches the code
*	at "exit" and manipulates return addresses on the stack in
*	order to assure that control never be passed to an interrupt
*	routine which intended to make an mli call but noted that
*	the "mli busy" flag (the HIGH BIT of the byte at "mliactv")
*	was high, and thus "deferred" its own execution by use of
*	the mechanism describe on page 108 of the ProDOS 8 Technical
*	Reference Manual in section 6.2.1, "Interrupts During MLI
*	Calls."  The problem involves the possibility of an
*	interrupt routine gaining control just after completion of
*	an mli call which was issued by PFI and before PFI was
*	itself done with its level of processing.  In such a case
*	the interrupt routine could then legally make a P8 call
*	which passed control to PFI, thus effectively re-entering
*	PFI.
*
*	To solve this problem, PFI now patches the "exit" code
*	and manipulates return addresses on the stack in such a
*	way that causes a deferred interrupt routine to gain
*	control only after PFI has finished its level of
*	processing and is ready to handle a P8 call if the
*	interrupt routine should issue one.
*	(Monte Benaresh -- April 1989)
*
*       101.	Expanded the size of the loader portion in order to make
*	room for a GS QuickDraw patch.  The loader portion of
*	the code is of predefined size and was previously $B00
*	bytes long.  This fact is hard-coded in  this file,
*	in the "ram.n file", and in the makefile, so expansion
*	of this area is a non-trivial task that required some
*	changes to be made by hand.  Those changes are logged in a
*	document titled "Loader Code Expansion Notes."
*
*	The patch, at label "InstallOSPatch," fixes a bug in the
*	5.0 System Disk where QuickDraw makes GS/OS calls without
*	first checking that the System is installed in the machine.
*	The patch installs code which is vectored into the GS/OS
*	entry points and returns an error for GS/OS calls.  This
*	fixes things because QuickDraw handles GS/OS errors properly.
*
*	The patch is called just before the label "itsp8" and
*	should only get executed when running on a GS and when P8
*	is being booted directly, i.e., not being installed by GQuit.
*	The patch disables interrupts (for no specific reason, only
*	as a precaution), switches the machine to native mode,
*	allocates memory for the "real" GS/OS patch, copies that code
*	into the allocated memory, sets up both GS/OS entry points
*	to point to their appropriate pieces of the code, restores
*	the environment and then returns.
*
*	Since these changes must be reflected in GQuit, the value
*	of the GS/OS compatibility byte on $BF00 page has been
*	changed from $01 to $02.  Also, GQuit now checks the size
*	of the P8 object file to ensure that it can find this byte
*	in the first place.  The size of the P8 file is now $3D7D
*	bytes.  The location of the GS/OS compatibility byte in
*	the P8 object file has moved from $50FA to $51FA.
*
*	Updated splash screen date text from "31-MAR-89"
*	to "23-MAY-89".
*	(Monte Benaresh -- May 1989)
*
* Version 1.9d1 - 12 Jun 90 - Greg Branche
*
*        102.	Bug fix to BRC #65472 - When displaying the message
*	'** SYSTEM PROGRAM TOO LARGE **', the code was looping
*	through the string intending to use the Y register as
*	a counter.  It was actually using a 'dex' instruction
*	instead of a 'dey'.  This has been corrected.
*
*        103.	Bug fix to BRC #65473 - When loading the first .SYSTEM
*	program found on disk, the code was making sure that
*	the program was not too big by checking the mid byte
*	of the file's EOF against the constant value $98.  This
*	was limiting the size of the file that could be loaded
*	to 38K when there's actually 39.75K available
*	($BF00-$2000).  This has been corrected by changing the
*	operand of the 'cmp' instruction to $9F.
*
*        104.	Redundant EQU's have been removed from ProcOne to
*	dispose of the assembler warnings.
*
*        105.	Loading X and Y for the subroutine call to 'reloc' has
*	been changed from absolute addressing to immediate
*	addressing.  This was done to save some space and
*	execution time (one less byte per load, plus the
*	addresses don't need to be stored in a table anymore).
*	This has been conditionally installed, though.  Only by
*	setting the 'needroom' equate to 1 will the changes
*	be made at assembly time.  Use the following line to
*	set the label value correctly.
needroom	equ 0
*
*        106.	An enhanced version of the Quit handler has been
*	added, along with the necessary logic to decide
*	which version of the handler to use.  The enhanced
*	version will automatically read a directory file
*	and display all files with type $FF or $0F (applications
*	or directories) for the user to select from.  The
*	user is allowed to use the arrow keys to move  a
*	selection cursor from name to name, RETURN to select
*	a name, TAB to step through the attached devices, or
*	ESC to close the current directory and step back one
*	directory in the pathname.  When the user presses
*	RETURN when the cursor is on a directory, that directory
*	is opened and the files contained within that directory
*	are displayed for selection.  If the selected file is
*	an application, the code will load the file and transfer
*	control to it.
*
*	This enhanced handler is only installed on //e or newer
*	machines that have an 80-column card installed.  Machines
*	that don't have the necessary hardware to support the
*	new handler will have the original QUIT handler installed.
*
*        107.	During a cold boot, if a .SYSTEM program can't be found
*	and the new quit code has been installed, the code
*	now performs a simple _Quit call to invoke the new
*	quit code.  This will allow the user to launch P8
*	without requiring a .SYSTEM program on the disk, yet
*	the user will still be able to select an application
*	to execute.
*
* Version 1.9B1 - 12 Jun 90 - Greg Branche
*	Only a version number change.  (Sure was easy!)
*
* Version 1.9   - 16 Jul 90 - Greg Branche
*	Golden Master build.
*
*	(Mods 110 & 111 performed 22 Aug 90 by Greg Branche)
*	(changes to source code bracketed by ;*** gab *** and ;*** end ***)
*
*       110.	Added support for second filename parameter when launching P8
*	applications from the P16 environment.  This convention is described
*	on page 88 of the ProDOS 8 Technical Reference Manual.  This is accomplished
*	by defining an alternate version of the dispatcher code that get's copied
*	to $D100-$D3ff in the second bank of the language card area of memory.
*	This normally get's patched by GQuit anyway, so the remainder of the code
*	might as well be used by GQuit to support the application launch.
*
******************************************************************
